package error;

import java.util.ArrayList;

public class Errors
{
	static ArrayList<Error> errors = new ArrayList<Error>();
	static int errorCount=0;
	static int warningCount=0;

	public static int getErrorCount()
	{
		return errorCount;
	}

	public static void addError(String fileName, String fileAlias, int line, String errorMsg)
	{
		errorCount++;
		errors.add(new Error(fileName, fileAlias, line, ErrorType.ERROR, errorMsg));
	}

	public static void addWarning(String fileName, String fileAlias, int line, String errorMsg)
	{
		warningCount++;
		errors.add(new Error(fileName, fileAlias, line, ErrorType.WARNING, errorMsg));
	}

	public static void print()
	{
		System.out.printf("Errors: %d  Warnings: %d\n", errorCount, warningCount);
		//for(ErrorType t : ErrorType.values())
			for (Error err : errors)
			//	if(err.errorType.equals(t))
					err.pring();
	}
}
